<!DOCTYPE HTML>
<html>
<head>
  <?php

  if (isset($title)) {
    $this->assign('title', $title);
  }

  echo $this->Html->css('bootstrap');
  echo $this->Html->css('admin');
  echo $this->Html->css('bootstrap-datepicker.min');
  echo $this->Html->css('font-awesome');

  echo $this->Html->script('jquery.min');
  echo $this->Html->script('jquery.metisMenu');
  echo $this->Html->script('bootstrap.min');
  echo $this->Html->script('bootstrap-datepicker.min');
  echo $this->Html->script('admin');

  echo $this->fetch('meta');
  echo $this->fetch('css');
  echo $this->fetch('script');

  ?>
  <title><?php echo $this->fetch('title'); ?> | Cherrie</title>
  <!-- Custom Theme files -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <link rel="shortcut icon" href="<?php echo $this->Html->webroot('img/icone.png') ?>">
  <link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
  <script type="text/javascript">
	function ajaxindicatorstart(text)
	{
		if(jQuery('body').find('#resultLoading').attr('id') != 'resultLoading'){
		jQuery('body').append('<div id="resultLoading" style="display:none"><div><?php echo $this->Html->image('ajax-loader.gif') ?><div>'+text+'</div></div><div class="bg"></div></div>');
		}

		jQuery('#resultLoading').css({
			'width':'100%',
			'height':'100%',
			'position':'fixed',
			'z-index':'10000000',
			'top':'0',
			'left':'0',
			'right':'0',
			'bottom':'0',
			'margin':'auto'
		});

		jQuery('#resultLoading .bg').css({
			'background':'#000000',
			'opacity':'0.7',
			'width':'100%',
			'height':'100%',
			'position':'absolute',
			'top':'0'
		});

		jQuery('#resultLoading>div:first').css({
			'width': '250px',
			'height':'75px',
			'text-align': 'center',
			'position': 'fixed',
			'top':'0',
			'left':'0',
			'right':'0',
			'bottom':'0',
			'margin':'auto',
			'font-size':'16px',
			'z-index':'10',
			'color':'#ffffff'

		});

	    jQuery('#resultLoading .bg').height('100%');
        jQuery('#resultLoading').fadeIn(300);
	    jQuery('body').css('cursor', 'wait');
	}

	function ajaxindicatorstop()
	{
	    jQuery('#resultLoading .bg').height('100%');
        jQuery('#resultLoading').fadeOut(300);
	    jQuery('body').css('cursor', 'default');
	}

  jQuery(document).ajaxStart(function () {
   		//show ajax indicator
		ajaxindicatorstart('Aguarde...');
  }).ajaxStop(function () {
		//hide ajax indicator
		ajaxindicatorstop();
  });
</script>
</head>
<body>
  <div id="wrapper">
    <nav class="navbar navbar-default navbar-cls-top " role="navigation" style="margin-bottom: 0">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="/"><?php echo $this->Html->image('logo.png', array('width' => '85px')) ?></a>
      </div>
      <div style="color: white;
      padding: 15px 50px 5px 50px;
      float: right;
      font-size: 16px;"><?php echo $this->Html->link('Sair', array('controller'=>'users','action'=>'logout', 'admin' => false), array('class' => 'btn btn-danger square-btn-adjust'))?> </div>
    </nav>
    <!-- /. NAV TOP  -->
    <nav class="navbar-default navbar-side" role="navigation">
      <div class="sidebar-collapse">
        <ul class="nav" id="main-menu">
          <!--li class="text-center">
            <img src="assets/img/find_user.png" class="user-image img-responsive"/>
          </li-->
          <li>
            <?php echo $this->Html->link("<i class='fa fa-dashboard fa-3x'></i> Início", array('controller' => 'users', 'action' => 'index'), array('escape' => false)); ?>
          <li>
            <?php echo $this->Html->link("<i class='fa fa-female fa-3x'></i> Produtos", array('controller' => 'produtos', 'action' => 'listar'), array('escape' => false)); ?>
          </li>
          <li>
            <?php echo $this->Html->link("<i class='fa fa-shopping-cart fa-3x'></i> Pedidos", array('controller' => 'compras', 'action' => 'listar'), array('escape' => false)); ?>
          </li>
          <li>
            <?php echo $this->Html->link("<i class='fa fa-truck fa-3x'></i> Fornecedores", array('controller' => 'fornecedores', 'action' => 'listar'), array('escape' => false)); ?>
          </li>
          <li>
            <?php echo $this->Html->link("<i class='fa fa-money fa-3x'></i> Ofertas", array('controller' => 'ofertas', 'action' => 'listar'), array('escape' => false)); ?>
          </li>
          <li>
            <?php echo $this->Html->link("<i class='fa fa-users fa-3x'></i> Usuários", array('controller' => 'users', 'action' => 'listar'), array('escape' => false)); ?>
          </li>
          <li>
            <?php echo $this->Html->link("<i class='fa fa-info fa-3x'></i> Banners", array('controller' => 'banners', 'action' => 'listar'), array('escape' => false)); ?>
          </li>
          <li>
            <?php echo $this->Html->link("<i class='fa fa-tag fa-3x'></i> Parâmetros<span class='fa arrow'></span></a>", array('controller' => 'fornecedores', 'action' => 'listar'), array('escape' => false)); ?>
            <ul class="nav nav-second-level">
              <li>
                <?php echo $this->Html->link("Categorias", array('controller' => 'categorias', 'action' => 'listar')); ?>
              </li>
              <li>
                <?php echo $this->Html->link("Sub-Categorias", array('controller' => 'tipos', 'action' => 'listar')); ?>
              </li>
              <li>
                <?php echo $this->Html->link("Situações", array('controller' => 'situacoes', 'action' => 'listar')); ?>
              </li>
              <li>
                <?php echo $this->Html->link("Cores", array('controller' => 'cores', 'action' => 'listar')); ?>
              </li>
              <li>
                <?php echo $this->Html->link("Tamanhos", array('controller' => 'tamanhos', 'action' => 'listar')); ?>
              </li>
              <li>
                <?php echo $this->Html->link("Tipos de Oferta", array('controller' => 'tipo_ofertas', 'action' => 'listar')); ?>
              </li>
            </ul>
          </li>
        </ul>
      </div>
    </nav>
    <!-- /. NAV SIDE  -->
    <div id="page-wrapper" >
      <?php echo $this->Session->flash(); ?>
      <?php echo $this->fetch('content'); ?>
    </div>
    <!-- /. PAGE WRAPPER  -->
  </div>
  <!-- /. WRAPPER  -->
</body>
</html>
